package com.markhsiu.string;

//8
public class CharAtDemo {  
    
    public static void main(String[] args) {  
        String str = null;  
        StringBuffer sb = new StringBuffer();  
          
        for (int i = 0; i < 1000; i++) {  
            sb.append(i).append(";");  
        }  
        str = sb.toString();  
          
        long begin = System.currentTimeMillis();  
          
        for (int i = 0; i < 10000000; i++) {  
            int len = str.length();  
            if (str.charAt(0) == 'a' && str.charAt(1) == 'b' && str.charAt(2) == 'c');  
            if (str.charAt(len - 3) == 'a' && str.charAt(len - 2) == 'b' && str.charAt(len - 1) == 'c');  
        }  
          
        long end = System.currentTimeMillis();  
        System.out.println(end - begin);  
    }  
  
}  